<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base href="<%=basePath%>" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>查询库存卡</title>
<link rel="stylesheet" type="text/css" href="admin/css/style.css" />
<link rel="stylesheet" type="text/css" media="all" href="admin/css/niceforms-default.css" />
<link rel="stylesheet" type="text/css" media="all" href="admin/js/date/jquery-ui-1.8.16.custom.css" />
<script type="text/javascript" src="admin/js/jquery.min.js"></script>
<script type="text/javascript" src="admin/js/niceforms.js"></script>
<script type="text/javascript" src="admin/js/ddaccordion.js"></script>
<script type="text/javascript" src="admin/js/jconfirmaction.jquery.js"></script>
<script type="text/javascript" src="admin/js/jquery.jclock-1.2.0.js"></script>
<script type="text/javascript" src="admin/js/date/jquery-ui-1.8.16.custom.min.js"></script>
<script type="text/javascript" src="admin/js/date/jquery.ui.datepicker-zh-CN.js"></script>

<script type="text/javascript">
ddaccordion.init({
	headerclass: "submenuheader", //Shared CSS class name of headers group
	contentclass: "submenu", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [1], //index of content(s) open by default [index1, index2, etc] [] denotes no content
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: false, //Should contents open by default be animated into view?
	persiststate: true, //persist state of opened contents within browser session?
	toggleclass: ["", ""], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["suffix", "<img src='<%=basePath%>admin/images/plus.gif' class='statusicon' />", "<img src='<%=basePath%>admin/images/minus.gif' class='statusicon' />"], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "fast", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(headers, expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
});
</script>
<script type="text/javascript">
	$(document).ready(function() {
		$('.ask').jConfirmAction();
	});
	
	$(function() {
	    $('.jclock').jclock();
	});
	
	$(function() {
		$("#operTime1").datepicker( {
			changeMonth : true,
			changeYear : true,
			dateFormat : 'yy-mm-dd'
		});
		$("#operTime2").datepicker( {
			changeMonth : true,
			changeYear : true,
			dateFormat : 'yy-mm-dd'
		});
		$("#ui-datepicker-div").css('font-size', '0.8em') //改变大小
	});
	
</script>
<script>
	function validate() {
		var faceValue = $('#faceValue').val();
		var vp = /^[0-9]+(.[0-9]{2})?$/;
		if(faceValue != '' && !vp.exec(faceValue)) {
			$('#error').html("请输入正确的面值，包含两位小数!");
			$('#faceValue').attr('value', '0.00');
			$('#faceValue').focus();
			return false;
		}
		if(faceValue == '') {
			$('#faceValue').attr('disabled', true);
			return true;
		}
		return true;
	}

	function query() {
		if(validate()) {
			document.queryForm.submit();
		}
	}
	
	function firstPage() {
		if(validate()) {
			document.queryForm.submit();
		}
	}
	
	function lastPage() {
		var currentPage = "<s:property value='pager.totalPage' />";
		$('#currentPage').attr('value', currentPage);
		if(validate()) {
			document.queryForm.submit();
		}
	}
	
	function backPage() {
		var currentPage = "<s:property value='pager.currentPage' />";
		$('#currentPage').attr('value', currentPage-1);
		if(validate()) {
			document.queryForm.submit();
		}
	}
	
	function nextPage() {
		var currentPage = "<s:property value='pager.currentPage' />";
		$('#currentPage').attr('value', currentPage+1);
		if(validate()) {
			document.queryForm.submit();
		}
	}
	
	function goPage() {
		var goPage = Number($('#goPage').attr('value'));
		if(isNaN(goPage)) {
			$('#goPage').attr('value', '')
			return;
		}
		$('#currentPage').attr('value', goPage);
		if(validate()) {
			document.queryForm.submit();
		}
	}
	
	function exportExcel() {
		if(validate()) {
			document.queryForm.action = "inventory!exportByQuery";
			document.queryForm.submit();
			document.queryForm.action = "inventory!queryInventory";
		}
	}
	
	
	$(function() {
		$( "#dialog" ).dialog({
			autoOpen: false,
			height: 200,
			width: 1000,
			modal: true,
			buttons: {
				"关闭": function() {
					$( this ).dialog( "close" );
					var id = $("#dialog tbody tr[mark='current']").attr('id');
					//alert(id);
					id = "#" + id;
					$(id).attr('style', 'display:none');
					$(id).attr('mark', 'hidden');
				}
			},
			close: function() {
			}
		});
	});
	
	
	function showDialog(seq) {
		//alert(seq);
		var id = "#" + seq;
		$(id).attr('style', '');
		$(id).attr('mark', 'current');
		$("#dialog").dialog("open");
	}
	
	
</script>

</head>

<body>
<div id="main_container">
       <%@include file="../header.jsp"%>
    <div class="main_content">
         <%@include file="menu.jsp"%>
   		 <div class="center_content">  
  		  <div class="left_content">
  				   <%@include file="sidebarmenu_sys.jsp"%>
    	  </div>  
    
		    <div class="right_content">            
		        
		      	<h5>当前位置: 卡系统 &gt; 卡库存管理 &gt; 查询库存卡</h5>
		        
		        
		        <!-- dialog -->
		        <div id="dialog" title="库存卡详细信息">
		      	<table style="padding: 8px;font-weight: normal;font-size: 13px;color: #52bfea;background: #ecf8fd;">
				    <thead>
				    	<tr>
				        	<th scope="col" class="rounded-company" width="1%"></th>
				            <th scope="col" class="rounded" width="50px">序号</th>
				            <th scope="col" class="rounded" width="150px">卡号</th>
				            <th scope="col" class="rounded" width="100px">面值(￥)</th>
				            <th scope="col" class="rounded" width="150px">卡类型</th>
				            <th scope="col" class="rounded" width="50px">发卡商</th>
				            <th scope="col" class="rounded" width="150px">批次号</th>
				            <th scope="col" class="rounded" width="80px">状态</th>
				            <th scope="col" class="rounded" width="80px">申请人</th>
				            <th scope="col" class="rounded" width="100px">创建时间</th>
				            <th scope="col" class="rounded" width="200px">描述</th>
				            <th scope="col" class="rounded-q4" width="1%"></th>
				        </tr>
				    </thead>
				    <tbody align="center">
				    	<!-- 
				    	<tr>
				    		<td colspan="12">&nbsp;</td>
				    	</tr>
				    	 -->
				    	<s:iterator value="pager.list" status="status">
				    	<tr id="<s:property value='#status.index+1' />" style="display: none;" mark="hidden">
				    		<td></td>
				        	<td><s:property value="#status.index+1" /></td>
				            <td><s:property value="inventoryNo" /></td>
				            <td><s:property value="faceValue" /></td>
				            <td><s:property value="materialTypeToString()" /></td>
				            <td><s:property value="cardIssuer.name" /></td>
				            <td><s:property value="batchNo" /></td>
				            <td><s:property value="statusToString()" /></td>
				            <td><s:property value="applicant" /></td>
				            <td><s:property value="createTimeToString()" /></td>
				            <td><s:property value="inventoryDesc" /></td>
				            <td></td>
				        </tr>
				        </s:iterator>
				    </tbody>
				</table>
				</div>
		        <!-- dialog -->
		        
		        
		        
		        <form action="inventory!queryInventory" id="queryForm" name="queryForm" method="post">
		        <input type="hidden" name="currentPage" id="currentPage" value="1" />
				<table id="rounded-corner" summary="2007 Major IT Companies' Profit">
				    <thead>
				    	<tr>
				        	<th scope="col" class="rounded-company" width="5%"></th>
				            <th scope="col" class="rounded" width="15%"></th>
				            <th scope="col" class="rounded" width="30%" align="right">查询库存卡</th>
				            <th scope="col" class="rounded" width="15%"></th>
				            <th scope="col" class="rounded" width="30%"></th>
				            <th scope="col" class="rounded-q4" width="5%"></th>
				        </tr>
				    </thead>
			        <tfoot>
			    		<tr>
			    			<td  class="rounded-foot-left"></td>
				        	<td></td>
				            <td>
				            	<a href="javascript:query();" class="bt_blue">
		         					<span class="bt_blue_lft"></span><strong>查询</strong><span class="bt_blue_r"></span>
		        				</a>
				            </td>
				            <td>
				            	<s:if test="pager.list.size() != 0">
					            	<a href="javascript:exportExcel();" class="bt_blue">
			         					<span class="bt_blue_lft"></span><strong>导出</strong><span class="bt_blue_r"></span>
			        				</a>
		        				</s:if>
		        				<s:else>
		        					<a href="javascript:history.back(-1);" class="bt_blue">
			         					<span class="bt_blue_lft"></span><strong>返回</strong><span class="bt_blue_r"></span>
			        				</a>
		        				</s:else>
				            </td>
				        	<td></td>
				        	<td class="rounded-foot-right">&nbsp;</td>
				        </tr>
				    </tfoot>
				    <tbody>
				    	<tr>
				    		<td colspan="6"></td>
				    	</tr>
				    	<tr>
				        	<td></td>
				            <td align="right">发卡商：</td>
				            <td align="left">
				            	<s:select list="cardIssuers" listKey="cardIssuerId" listValue="name" value="%{inventory.cardIssuer.cardIssuerId}" headerKey="-1" headerValue=" -- 请选择 -- " 
				            		name="inventory.cardIssuer.cardIssuerId" id="cardIssuerId" theme="simple" cssStyle="font-size:12px;"></s:select>
				            </td>
				            <td align="right">卡类型：</td>
				            <td align="left">
				            	<s:select list="#application.dics.DIC_CARD_MATERIAL_TYPE" listKey="value" listValue="name" value="%{inventory.materialType}" headerKey="-1" headerValue=" -- 请选择 -- " 
				            		name="inventory.materialType" id="materialType" theme="simple" cssStyle="font-size:12px;"></s:select>
				            </td>
				            <td></td>
				        </tr>   
				        <tr>
				        	<td></td>
				            <td align="right">卡状态：</td>
				            <td align="left">
					            <s:select list="#application.dics.DIC_CARD_BATCH_STATUS" listKey="value" listValue="name" value="%{inventory.status}" headerKey="-1" headerValue=" -- 请选择 -- " 
					            		name="inventory.status" id="status" theme="simple" cssStyle="font-size:12px;"></s:select>
				            </td>
				            <td align="right">批次号：</td>
				            <td align="left"><input type="text" name="inventory.batchNo" id="batchNo" value="${inventory.batchNo}" size="18" maxlength="14" title="请输入批次号" /></td>
				            <td></td>
				        </tr> 
				        <tr>
				        	<td></td>
				        	<td align="right"> 卡 号 ：</td>
				            <td align="left"><input type="text" name="inventory.inventoryNo" id="inventoryNo" value="${inventory.inventoryNo}" size="18" maxlength="10" title="请输入卡号" /></td>
				            <td align="right"> 面 值 ：</td>
				            <td align="left"><input type="text" name="inventory.faceValue" id="faceValue" value="${inventory.faceValue}" size="18" title="精确到小数点后两位，如0.00" /> (￥)</td>
				            <td></td>
				        </tr> 
				        <tr>
				        	<td></td>
				            <td align="right">创建时间：</td>
				            <td align="left" colspan="3">
				            	From <input type="text" name="operTime1" id="operTime1" value="${operTime1}" size="12" maxlength="12" />
				            	 To  <input type="text" name="operTime2" id="operTime2" value="${operTime2}" size="12" maxlength="12" />
				            </td>
				            <td></td>
				        </tr> 
				        <tr>
				        	<td colspan="2"></td>
				            <td colspan="2" align="left">
				            	<label id="error" class="error"></label>
				            </td>
				            <td colspan="2"></td>
				        </tr>
				    </tbody>
				</table>
				</form>
		        
		           
		        <s:if test="pager.list.size() != 0">        
				<table id="rounded-corner" summary="2007 Major IT Companies' Profit">
				    <thead>
				    	<tr>
				        	<th scope="col" class="rounded-company" width="1%"></th>
				            <th scope="col" class="rounded" width="3%">序号</th>
				            <th scope="col" class="rounded" width="10%">卡号</th>
				            <th scope="col" class="rounded" width="5%">面值(￥)</th>
				            <th scope="col" class="rounded" width="5%">卡类型</th>
				            <th scope="col" class="rounded" width="5%">发卡商</th>
				            <th scope="col" class="rounded" width="10%">批次号</th>
				            <th scope="col" class="rounded" width="5%">状态</th>
				            <th scope="col" class="rounded-q4" width="1%"></th>
				        </tr>
				    </thead>
			        <tfoot>
			    		<tr>
				        	<td class="rounded-foot-left" colspan="4">
				        	<div class="pager">
					     		共<s:property value="pager.totalSize" />条记录，
					     		当前第<s:property value="pager.currentPage" /> / <s:property value="pager.totalPage" />页
		     				</div>
				        	</td>
				        	
				        	<td colspan="4">
				        		<div class="goPage">
									<a href="javascript:firstPage();">|&lt;&lt; first</a>
									<a href="javascript:backPage();"><span>&lt;&lt; prev</span></a>
									<a href="javascript:void(0)"><input type="text" name="goPage" id="goPage" value="" size="2" maxlength="4" onblur="goPage();" /></a>
									<a href="javascript:nextPage();">next &gt;&gt;</a>
									<a href="javascript:lastPage();">last &gt;&gt;|</a>
						        </div>
				        	</td>
				        	<td class="rounded-foot-right">&nbsp;</td>
				        </tr>
				    </tfoot>
				    <tbody>
				    	<s:iterator value="pager.list" status="status">
				    	<tr>
				    		<td></td>
				        	<td><s:property value="#status.index+1" /></td>
				            <td>
				            	<a href="javascript:showDialog(<s:property value="#status.index+1" />);">
				            		<s:property value="inventoryNo" />
				            	</a>
				            </td>
				            <td><s:property value="faceValue" /></td>
				            <td><s:property value="materialTypeToString()" /></td>
				            <td><s:property value="cardIssuer.name" /></td>
				            <td><s:property value="batchNo" /></td>
				            <td><s:property value="statusToString()" /></td>
				            <td></td>
				        </tr>
				        </s:iterator>
				    </tbody>
				</table>
		        </s:if> 
		        <s:else>
		        	<span class="error"><s:fielderror fieldName="msg"></s:fielderror></span>
		        </s:else>
		     
			</div>  <!-- end of right content-->
                    
		</div>  <!--end of center content -->               
    
		<div class="clear"></div>
	
    </div>  <!--end of main content-->
	
    
    <%@include file="../footer.jsp" %>

</div>		
</body>
</html>